package com.xinyue.user.controller;

import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xinyue.user.pojo.Comment;
import com.xinyue.user.service.Impl.CommentServiceImpl;


@RestController
public class CommentController {

	@Autowired
	private CommentServiceImpl commentService;
	
	@GetMapping("/insertComment")
	public void insertComment(HttpSession session,Comment comment) {
		try {
			/*
			 * User user = (User)session.getAttribute("username"); 
			 * comment.setUid(user.getId());
			 */
			//设置发送信息的时间
			java.sql.Date time= new java.sql.Date(new Date().getTime());
			comment.setDate(time);
			comment.setUid(1);
			commentService.insert(comment);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	
	
	
	
	
	
}
